//accepted
#include <cstdio>

int main(){
	//freopen("in.txt","r",stdin);
	int g, l, t;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d", &g, &l);
		if(l%g)
			printf("-1\n");
		else
			printf("%d %d\n", g, l);
	}
	return 0;
}
